Function getDiskLetterInfo(Letter, HostName)
    Set CS = GetObject("winmgmts://" + HostName + "/root/cimv2")
    Set ds = CS.ExecQuery("Select * from Win32_LogicalDisk")
    found = False
    For Each Item In ds
        If (Item.DeviceID = Letter) Then
            found = True
            WScript.Echo Item.DeviceID
            WScript.Echo Item.DriveType
            WScript.Echo Item.Size
            WScript.Echo Item.FreeSpace
            WScript.Echo Item.FileSystem
            WScript.Echo Item.VolumeSerialNumber
            WScript.Echo Item.VolumeName
        End If
    Next
    If found = False Then
        WScript.Echo Null
    End If
End Function

Function getHard_DiskInfo(HostName)
    Set CS = GetObject("winmgmts://" + HostName + "/root/cimv2")
    Set ds = CS.ExecQuery("Select * from Win32_DiskDrive")
    For Each Item In ds
        WScript.Echo "-"
        WScript.Echo Item.DeviceID
        WScript.Echo Item.Index
        WScript.Echo Item.Size
        WScript.Echo Item.InterfaceType
        WScript.Echo Item.Model
        WScript.Echo Item.SerialNumber
    Next
End Function

Function getOptical_DiskInfo(HostName)
    Set CS = GetObject("winmgmts://" + HostName + "/root/cimv2")
    Set ds = CS.ExecQuery("Select * from Win32_CDROMDrive")
    For Each Item In ds
        WScript.Echo "-"
        WScript.Echo Item.Name
        WScript.Echo Item.Drive
        WScript.Echo Item.Size
        WScript.Echo Item.SerialNumber
    Next
End Function

Function getDisk_PartitionInfo(HostName)
    Set CS = GetObject("winmgmts://" + HostName + "/root/cimv2")
    Set ds = CS.ExecQuery("Select * from Win32_DiskPartition")
    For Each Item In ds
        WScript.Echo "-"
        WScript.Echo Item.DiskIndex
        WScript.Echo Item.Index
        WScript.Echo Item.Size
        WScript.Echo Item.PrimaryPartition
    Next
End Function

Sub Main(param)
    param_number = 0
    For Each Item In param
        param_number = param_number + 1
    Next
    
    PC = "."
    letterString = "C:"
    
    Select Case param_number
        Case 3:
            If param(2) = Null Then
                PC = "."
            Else
                PC = param(2)
            End If
            If param(1) = Null Then
                letterString = "C:"
            Else
                letterString = param(1)
            End If
        Case 2:
            PC = "."
            If param(1) = Null Then
                letterString = "C:"
            Else
                letterString = param(1)
            End If
        Case 1:
            PC = "."
            letterString = "C:"
        Case Else
            WScript.Echo "param Error"
            WScript.Quit 1
    End Select
    
    Select Case param(0)
        Case "Letter":
            WScript.Echo ""
            getDiskLetterInfo letterString, PC
        Case "Hard_Disk":
            getHard_DiskInfo PC
        Case "Optical_Disk":
            getOptical_DiskInfo PC
        Case "Disk_Partition":
            getDisk_PartitionInfo PC
        Case Else
            WScript.Echo "Not Exist This Operate"
            WScript.Quit 1
    End Select
End Sub

Main (WScript.Arguments)
